package me.base.utils;

import cn.hutool.crypto.digest.BCrypt;
import lombok.experimental.UtilityClass;

@UtilityClass
public class PasswordUtil {

    public String encrypt(String plaintext) {
        return BCrypt.hashpw(plaintext, BCrypt.gensalt());
    }

    public boolean validPassword(String plaintext, String storedPwd) {
        return BCrypt.checkpw(plaintext, storedPwd);
    }
}
